|
|
 |
|
|
|
|
newt = newt + (MaxPt + 1)
Loop
Blend = Blend(0, k, newt)
Exit Function
End If
' Base case for the recursion. If k = 1 Then
If (Knot(i) <= t) And (t < Knot(i + 1)) Then
Blend = 1
ElseIf (t = MaxT) And (Knot(i) <= t) And _
(t <= Knot(i + 1)) _
Then
Blend = 1
Else
Blend = 0
End If
Exit Function
End If
denom = Knot(i + k - 1) - Knot(i)
If denom = 0 Then
value1 = 0
Else
numer = (t - Knot(i)) * Blend(i, k - 1, t)
value1 = numer / denom
End If
denom = Knot(i + k) - Knot(i + 1)
If denom = 0 Then
value2 = 0
Else
numer = (Knot(i + k) - t) * Blend(i + 1, k - 1, t)
value2 = numer / denom
End If
Blend = value1 + value2
End Function |
|
|
|
|
|
|
|
|
The only other difference in drawing open and closed B-splines is that t must vary from 0 to N + 1 to draw the entire closed curve. |
|
|
|
|
|
|
|
|
Example program BSpline2 uses these functions to draw closed B-splines in a manner very similar to the way program BSpline draws open B-splines. |
|
|
|
|
|